package com.qiaofang.collectmanage.service.util;

import com.qiaofang.collectmanage.dao.domain.CollectQuality;
import com.qiaofang.collectmanage.stub.bean.*;

import java.util.Date;
import java.util.UUID;

/**
* Created by generator on 2018-8-1 13:49:21
*/
public class CollectQualityServiceConvert {

    private CollectQualityServiceConvert(){}

     public static  CollectQuality  convertDTO2Domain(CollectQualityDTO taskDTO){
     	if(taskDTO == null){
           return null;
         }
         CollectQuality task = new  CollectQuality();
           task.setId(taskDTO.getId());
           task.setUuid(taskDTO.getUuid());
           task.setCreatedUserUuid(taskDTO.getCreatedUserUuid());
           task.setUpdatedUserUuid(taskDTO.getUpdatedUserUuid());
        return task;
     }

    public static  CollectQuality  convertSaveDTO2Domain(SaveCollectQualityDTO taskDTO){
        if(taskDTO == null){
           return null;
        }
        CollectQuality  task = new  CollectQuality();
        task.setUuid(taskDTO.getUuid());
        return task;
    }

    public static  CollectQuality  convertUpdateDTO2Domain(UpdateCollectQualityDTO taskDTO){
        if(taskDTO == null){
            return null;
        }
        CollectQuality  task = new  CollectQuality();
        task.setId(taskDTO.getId());
        task.setUuid(taskDTO.getUuid());
        return task;
    }


    public static  CollectQuality  convertListDTO2Domain(ListCollectQualityDTO taskDTO){
        if(taskDTO == null){
            return null;
        }
        CollectQuality  task = new  CollectQuality();
        task.setId(taskDTO.getId());
        task.setUuid(taskDTO.getUuid());
        return task;
    }

     public static CollectQualityDTO convertDomain2DTO(CollectQuality task){
     	if(task ==null){
           return null;
        }
         CollectQualityDTO taskDTO = new CollectQualityDTO();
            taskDTO.setId(task.getId());
            taskDTO.setUuid(task.getUuid());
            taskDTO.setCreatedUserUuid(task.getCreatedUserUuid());
            taskDTO.setUpdatedUserUuid(task.getUpdatedUserUuid());
          return taskDTO;
     }

    public static CollectQuality convertSaleAndRentalDTO2Domain(ChannelSaleAndRentalDTO channelSaleAndRentalDTO){
        if(channelSaleAndRentalDTO ==null){
            return null;
        }
        CollectQuality collectQuality = new CollectQuality();
        collectQuality.setUuid(UUID.randomUUID().toString());
        collectQuality.setCity(channelSaleAndRentalDTO.getCity());
        collectQuality.setBelonger(channelSaleAndRentalDTO.getBelonger());
        collectQuality.setSource(channelSaleAndRentalDTO.getSource());
        collectQuality.setCollectHouseType(channelSaleAndRentalDTO.getCollectHouseType());
        collectQuality.setTimeInterval(new Date());
        collectQuality.setPlatform(channelSaleAndRentalDTO.getPlatform());
        collectQuality.setCreatedTime(new Date());
        collectQuality.setTodaySaleHouseCount(channelSaleAndRentalDTO.getSaleTodayNum());
        collectQuality.setTodayRentalHouseCount(channelSaleAndRentalDTO.getRentalTodayNum());
        collectQuality.setTotalSaleHouseCount(channelSaleAndRentalDTO.getSaleNum());
        collectQuality.setTotalRentalHouseCount(channelSaleAndRentalDTO.getRentalNum());
        return collectQuality;
    }







}
